﻿using System;
using System.Windows.Forms;
using Styx;

namespace FocusHelper.Gui
{
    public partial class NameInput : Form
    {
        private FocusHelper myParent { get; set; }

        public NameInput(FocusHelper parent)
        {
            myParent = parent;
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FocusHelperSettings.mInstance.mFocusName = string.IsNullOrEmpty(textBox1.Text) || textBox1.Text.Trim().Length == 0 ? null : textBox1.Text;

            myParent.PrintFocus();

            FocusHelperSettings.mInstance.Save();
            Close();
        }

        private void NameInput_Load(object sender, EventArgs e)
        {
            textBox1.Text = FocusHelperSettings.mInstance.mFocusName;
        }
    }
}
